package MultiMediaPlayer.Media.Facade;

import MultiMediaPlayer.Interface.PlatForm;
import MultiMediaPlayer.Media.Media;
import MultiMediaPlayer.PlatForm.LinuxPlatform;
import MultiMediaPlayer.PlatForm.WindowsPlatform;

//外观模式
public class MediaFacade {
    private Media media;

    public void playMedia(Media media, String platFormType) {
        PlatForm platForm;
        switch (platFormType) {
            case "windows":
                platForm = new WindowsPlatform();
                break;
            case "linux":
                platForm = new LinuxPlatform();
                break;
            default:
                System.out.println("未知平台");
                return;
        }

        switch (media.getName()) {
            case "MP3","MP4","AVI": {
                platForm.decode(media.getName());
                media.play();
                break;
            }
            default:
                System.out.println("不支持的媒体格式");
                break;
        }
    }
}